#ifndef GAMESCENE_H
#define GAMESCENE_H

#include <QGraphicsScene>
#include <chessdata.h>
#include <chesspiece.h>
#include <QHash>
#include "desktopitem.h"

class GameScene : public QGraphicsScene
{
public:
    explicit GameScene(QObject *parent = nullptr);

    void initGameScene();

    ~GameScene();

    const ChessData * getChessData();

    ChessData * getChessDataPtr();

    void saveSxSy(double sx,double sy,double r,double d);

    void printBoardInfo();

    void saveChessPiece(ChessPiece* cp,int col,int row);

    void cancelSelectPiece(int col,int row);

    void saveDesktopItem(DesktopItem* desktopItem);

    // QGraphicsScene interface
protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);

private:
    ChessData* chessData;

    //QHash<int,ChessPiece*>* pHash;

    ChessPiece* pieceBoard[ChessData::max_col+1][ChessData::max_row+1];

    DesktopItem* desktopItem;
};

#endif // GAMESCENE_H
